package generics;

import java.util.ArrayList;
import java.util.List;


public class GenericExtendsFinalClass {

	public static void main(String[] args) {
		method("Generic types shouldn' t be bounded to final classes!");
		List<String> list = new ArrayList<String>();
		list.add("No warning!-");
		list.add("No warning!--");
		method2(list);
		
		List<B> list2 = new ArrayList<GenericExtendsFinalClass.B>();
		method3(list2);
		method4(list2);
	}

	public static <T extends String> void method(T t) {
		System.out.println(t);
	}
	
	public static void method2(List<? extends String> t) {
		for (String string : t) {
			System.out.println(string);
		}
//		t.add(null);
//		t.add("");
//		t = new ArrayList<String>();
//		String s = t.get(0);
//		Object object = t;
//		t = new ArrayList<Object>();
	}
	
	public static void method3(List<? extends A> list) {
		
	}
	
	public static void method4(List<? extends Object> list) {
		
	}
	
	static class A {
		
	}
	
	static class B extends A {
		
	}
}
